#!/usr/bin/env python
#coding=utf-8

import os
import time

firstTime=time.time()
for i in range(10):
	os.system('adb shell /system/bin/uiautomator dump --compressed /data/local/tmp/liukangUi.xml')
	os.system('adb pull /data/local/tmp/liukangUi.xml D:\Xml.xml')
	with open(r'D:\Xml.xml', 'r' ,encoding='UTF-8') as f:
	#with open(r'D:\Xml.xml', 'r' ) as f:
		#print(f.read())
		strr=r'微信'
		#str=str.decode("utf-8")
		print(strr)
		if strr in  f.read():
			print('ttttt')
			os.system('adb shell input tap 441  287')
			time.sleep(0.2)
			# os.system('adb shell input tap 431  2062')
			os.system('adb shell input swipe 431  2062 431  2062 500')
			#time.sleep(0.2)
			# os.system('adb shell am broadcast -a ADB_INPUT_TEXT --es msg "一"')
			# os.system('adb shell input text "bubbatetsrrr等等"')#在文本框输入内容
			os.system('adb shell input tap  116   1939')
			#time.sleep(0.2)
			# os.system('adb shell input tap  1015  1275')
			os.system('adb shell input tap   1016  2077')
			time.sleep(0.2)
			os.system('adb shell input tap 73  118')
			#time.sleep(0.1)


		else:
			print('fffff')
endTime = time.time()
print(firstTime)
print(endTime)
'''
   # os.system('adb shell input swipe 250 420 250 254') 
	os.system('adb shell input tap 441  287')
	time.sleep(0.2)
    #os.system('adb shell input tap 431  2062') 
	os.system('adb shell input swipe 431  2062 431  2062 500')   

	time.sleep(0.2)
    #os.system('adb shell am broadcast -a ADB_INPUT_TEXT --es msg "一"')
    #os.system('adb shell input text "bubbatetsrrr等等"')#在文本框输入内容
	os.system('adb shell input tap  116   1939')  
	time.sleep(0.2)
    #os.system('adb shell input tap  1015  1275') 
	os.system('adb shell input tap   1016  2077') 
	time.sleep(0.2)
	os.system('adb shell input tap 73  118') 
	time.sleep(0.1)
endTime=time.time()
print(firstTime)
print(endTime)'''

'''print(time.time())
os.system('adb shell /system/bin/uiautomator dump /data/local/tmp/liukangUi.xml')
os.system('adb pull /data/local/tmp/liukangUi.xml D:\Xml')
print(time.time())'''